package com.guigu.dealservice.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.guigu.dealservice.dto.Equipment;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author janecraft
 * @since 2025-10-17
 */
@TableName("bargain_intention")
public class BargainIntention implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 砍价意向唯一标识
     */
    @TableId(value = "bargain_id", type = IdType.AUTO)
    private Long bargainId;

    /**
     * 关联用户表user_id（发起砍价的买家）
     */
    private Long userId;

    /**
     * 关联设备表equipment_id（目标砍价设备）
     */
    private Long equipmentId;

    /**
     * 设备原价（关联设备表price字段，冗余存储避免后续价格变动影响记录）
     */
    private BigDecimal originalPrice;

    /**
     * 用户意向砍价价格（用户期望的成交价格）
     */
    private BigDecimal intentionPrice;

    /**
     * 砍价备注（用户补充说明，如"希望尽快成交，可自提"）
     */
    private String bargainRemark;

    /**
     * 砍价状态（0-待卖家回复，1-卖家同意，2-卖家拒绝）
     */
    private Integer bargainStatus;

    /**
     * 卖家回复（bargain_status=1或2时填写，如"同意此价格，可随时交易"）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String sellerReply;

    /**
     * 卖家回复时间（bargain_status变更为1或2时记录）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime replyTime;

    /**
     * 记录创建时间（用户发起砍价的时间）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 记录更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    //映射用户名称
    @TableField(exist = false)
    String userName;
    //映射设备名称
    @TableField(exist = false)
    Equipment equipment;


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Long getBargainId() {
        return bargainId;
    }

    public void setBargainId(Long bargainId) {
        this.bargainId = bargainId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getEquipmentId() {
        return equipmentId;
    }

    public void setEquipmentId(Long equipmentId) {
        this.equipmentId = equipmentId;
    }

    public BigDecimal getOriginalPrice() {
        return originalPrice;
    }

    public void setOriginalPrice(BigDecimal originalPrice) {
        this.originalPrice = originalPrice;
    }

    public BigDecimal getIntentionPrice() {
        return intentionPrice;
    }

    public void setIntentionPrice(BigDecimal intentionPrice) {
        this.intentionPrice = intentionPrice;
    }

    public String getBargainRemark() {
        return bargainRemark;
    }

    public void setBargainRemark(String bargainRemark) {
        this.bargainRemark = bargainRemark;
    }

    public Integer getBargainStatus() {
        return bargainStatus;
    }

    public void setBargainStatus(Integer bargainStatus) {
        this.bargainStatus = bargainStatus;
    }

    public String getSellerReply() {
        return sellerReply;
    }

    public void setSellerReply(String sellerReply) {
        this.sellerReply = sellerReply;
    }

    public LocalDateTime getReplyTime() {
        return replyTime;
    }

    public void setReplyTime(LocalDateTime replyTime) {
        this.replyTime = replyTime;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Equipment getEquipment() {
        return equipment;
    }

    public void setEquipment(Equipment equipment) {
        this.equipment = equipment;
    }

    @Override
    public String toString() {
        return "BargainIntention{" +
        "bargainId = " + bargainId +
        ", userId = " + userId +
        ", equipmentId = " + equipmentId +
        ", originalPrice = " + originalPrice +
        ", intentionPrice = " + intentionPrice +
        ", bargainRemark = " + bargainRemark +
        ", bargainStatus = " + bargainStatus +
        ", sellerReply = " + sellerReply +
        ", replyTime = " + replyTime +
        ", createTime = " + createTime +
        ", updateTime = " + updateTime +
        ", userName = " + userName +
        ", equipment = " + equipment +
        "}";
    }
}
